# 农历转换模块

from datetime import datetime
try:
    from lunarcalendar.converter import SolarTerm
except ImportError:
    from lunarcalendar import Converter as SolarTerm
def get_chinese_zodiac(year):
    """获取生肖"""
    zodiacs = ['猴', '鸡', '狗', '猪', '鼠', '牛', '虎', '兔', '龙', '蛇', '马', '羊']
    return zodiacs[(year - 4) % 12]


def get_solar_terms(year: int, month: int) -> list:
    """获取精确节气信息"""
    terms = []
    for day in range(1, 32):
        try:
            date_obj = datetime(year, month, day)
            term = SolarTerm.get_solar_term(date_obj)
            if term:
                terms.append((term.name, date_obj.strftime('%Y-%m-%d %H:%M:%S')))
        except ValueError:
            continue
    return terms
